﻿using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TheAPI.Data;

namespace TheAPI
{
    public class GameModule : Module
    {
        private const string VERSION = "v1.3";
        private const string MODULE = "game";

        public GameModule(RiotGamesAPI api)
            : base(api)
        {
        }

        public RecentGames RetrieveRecentGames(string summonerId)
        {
            var request = new RestRequest("api/lol/{region}/{version}/{module}/by-summoner/{summonerId}/recent", Method.GET);
            request.AddUrlSegment("region", API.RegionString);
            request.AddUrlSegment("version", VERSION);
            request.AddUrlSegment("module", MODULE);
            request.AddUrlSegment("summonerId", summonerId);

            request.AddParameter("api_key", API.APIKey);

            return REST<RecentGames>(request);
        }
    }
}
